<ul class="breadcrumb">
    <li><a href="/com/mods/list">我的Mod列表</a></li>
    <li><a href="/com/mods/list">Mod名称</a></li>
    <li class="active">修改Mod信息</li>
</ul>
<form action="/com/mods/edit/{$id}?do=submit" method="POST">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">Mod标签(可多选)</h3>
        </div>
        <div class="panel-body">
            <div class=" list-group list-group-horizontal">
            {$flagshtml}
            </div>
        </div>
    </div>
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">简称</h3>
        </div>
        <div class="panel-body">
            <input type="text" name="name" class="form-control" value="{$name}">
        </div>
    </div>
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">全称</h3>
        </div>
        <div class="panel-body">
            <input type="text" name="fullname" class="form-control" value="{$fullname}">
        </div>
    </div>
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">英文名称</h3>
        </div>
        <div class="panel-body">
            <input type="text" name="enname" class="form-control" value="{$enname}">
        </div>
    </div>
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">简介</h3>
        </div>
        <div class="panel-body">
            <textarea name="desc" rows="5" class="form-control" cols="40">{$description}</textarea>
        </div>
    </div>    
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">作者</h3>
        </div>
        <div class="panel-body">
            <input type="text" name="author" class="form-control" value="{$author}">
        </div>
    </div>    
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">适用游戏版本(多个用|隔开)</h3>
        </div>
        <div class="panel-body">
            <input type="text" name="appver" class="form-control" value="{$appver}">
            <input type="hidden" id="flags" name="flags" class="form-control" value="{$modflags}">
        </div>
    </div>    
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">Submit</h3>
        </div>
        <div class="panel-body">
            <input type="submit" class="btn btn-info" value="提交">
        </div>
    </div>
</form>
<script>
var flags=[];
var d=$("#flags").val();
var f=JSON.parse(d);
for(var i=0;i<f.length;i++){
    var othis=$("[data-id="+f[i]+"]");
    othis.addClass("active");
    flags.push(f[i]);
}
$(".list-group-item").click(function(othis){
    var context=$(othis.currentTarget);
    if(context.hasClass("active")){
        context.removeClass("active");
        flags.pop(context.attr('data-id'));
    }else{
        flags.push(context.attr('data-id'));
        context.addClass("active");
    }
    $("#flags").val(JSON.stringify(flags));
});
</script>